package com.hjb.service.impl;

import com.hjb.entity.User;
import com.hjb.mapper.UserMapper;
import com.hjb.service.UserService;
import com.hjb.uils.MybatisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author JianBinHuang
 * @Description
 * @Date 2021/9/8 9:30
 */
@Service
public class UserServiceImpl implements UserService {

    /**
     * @Author JianBinHuang
     * @Date 2021/9/8 10:18
     * @param
     * @return
     * @Description
     * 引用 Mybatis工具包
     */
    private UserMapper mapper = MybatisUtils.getMapper(UserMapper.class);

    @Override
    public List<User> queryAll() {
        return mapper.queryAll();
    }

    @Override
    public int deleteById(int id) {
        return mapper.deleteById(id);
    }

    @Override
    public int addUser(User user) {
        return mapper.addUser(user);
    }

    @Override
    public User queryById(int id) {
        return mapper.queryById(id);
    }

    @Override
    public int update(User user) {
        return mapper.update(user);
    }
}
